package closure01

//判断参数个数或者类型，动态选择
def compliteAmount(money,closure){
    result=0
    //parameterTypes : 检查参数类型
    if(closure.maximumNumberOfParameters==2){//判断参数个数
        result=closure(money,0.625)
    }else{
        result=closure money
    }
    println result
}
//动态传递参数
compliteAmount(100) {it*0.8}
compliteAmount(100) {money,rate->money*(rate/0.8)}
